package com.wz.myvideoview.activity;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import com.wz.myvideoview.view.MyController;
import com.wz.myvideoview.R;

public class MainActivity extends AppCompatActivity {
    private String url = "/storage/emulated/0/DCIM/Camera/VID_20171023_095917.mp4";
    private String url2 = "http://tanzi27niu.cdsb.mobi/wps/wp-content/uploads/2017/04/2017-04-28_18-20-56.mp4";
    private String thumbUrl = "http://cs.vmoiver.com/Uploads/Banner/2016/12/27/58622f0fd756b.jpg";
    private String title = "2017值得期待的上映大片";
    private MyController myVideoPlayer;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        myVideoPlayer = (MyController) findViewById(R.id.myVideoPlayer);
        myVideoPlayer.initVideo(url2,thumbUrl,title);
    }

    @Override
    protected void onResume() {
        super.onResume();
    }

    @Override
    protected void onPause() {
        super.onPause();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        myVideoPlayer.onStop();
    }

    @Override
    public void onBackPressed() {
        if(!myVideoPlayer.onBackPressed()){
            super.onBackPressed();
        }
    }
}
